package icu.d4peng.basic.satoken.spring.pathmatch;

import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

/**
 * SaPathMatcherHolder:路径配置
 *
 * @author d4peng <a href="d4peng@qq.com">d4peng@qq.com</a>
 * @since 2023.12.02
 */
public class SaPathMatcherHolder {

	private SaPathMatcherHolder() {
	}

	/**
	 * 路由匹配器
	 */
	public static PathMatcher pathMatcher;

	/**
	 * 获取路由匹配器
	 * @return 路由匹配器
	 */
	public static PathMatcher getPathMatcher() {
		if (pathMatcher == null) {
			pathMatcher = new AntPathMatcher();
		}
		return pathMatcher;
	}

	/**
	 * 写入路由匹配器
	 * @param pathMatcher 路由匹配器
	 */
	public static void setPathMatcher(PathMatcher pathMatcher) {
		SaPathMatcherHolder.pathMatcher = pathMatcher;
	}

}
